import request from '@/utils/request';
import { apiServer } from '@/utils/constants';

const api = {
  importFile: '/api/text/importFile',
  generateCode: '/api/codeGenerate/generateCode',
  allTemplates: '/api/codeGenerate/findAll',
};

export async function allTemplates (params) {
  return request(apiServer + api.allTemplates, {
    method: 'POST',
    body: params.data,
  });
}

export async function importFile (params) {
  return request(apiServer + api.importFile, {
    method: 'POST',
    body: params,
  });
}

export async function generateCode (params) {
  return request(apiServer + api.generateCode, {
    method: 'POST',
    body: params.data,
  });
}
